// 1. 引入
import Vue from 'vue'
import VueRouter from 'vue-router'
import index from '@/views/index.vue'
import news from '@/views/news.vue'
import sports from '@/views/sports.vue'
import sportsIndex from '@/views/sportsIndex.vue'
import sportsHomeland from '@/views/sportsHomeland.vue'
import sportsForeign from '@/views/sportsForeign.vue'

// 2. 调用 Vue.use() 去注册这个插件
Vue.use(VueRouter)
// 3. 创建路由实例
const router = new VueRouter({
  routes: [
    {
      path: '/',
      redirect:'/index'
    },
    {
      path: '/index',
      component:index
    },
    {
      path: '/news',
      component:news
    },
    {
      path: '/sports',
      component: sports,
      children: [
        {
          path: 'sportsindex',
          component: sportsIndex
        },
        {
          path: 'sportshomeland',
          component: sportsHomeland
        },
        {
          path: 'sportsforeign',
          component: sportsForeign
        },
      ]
    },
  ]
})

// 对外暴露路由实例
export default router